/*global API_HOST:false isMock:false*/
const env = API_HOST
const apiUrl = {
  dev: {
    // 公用
    apiUrl: '//api.108sq.org:8702'
  },
  pre: {
    apiUrl: '//api-pre.108sq.cn'
  },
  prod: {
    apiUrl: '//api.108sq.cn'
  }
}
export const api = apiUrl[env]

export const scheme = {
  // 我的消费订单  tab=0 全部  tab=1 待评价    refresh = evaluated   刷新
  order: 'com108sq://consumer/order'
}

const hostResolve = (path, domain = 'apiUrl') => {
  if (isMock === 'true') {
    return path
  } else {
    for (let key of Object.keys(path)) {
      path[key] = `${api[domain]}${path[key]}`
    }
    return path
  }
}

// 公用接口
export const common = {
  ...hostResolve({
    // 精选优惠-优惠券详情 orderType 1 最优惠 2 最人气 3 距离最近
    PopularityEssenceList: '/saleticket/front/commodity/{orderType}/essenceList'
  })
}

